package com.bite.lesson3;

public class Demo_01 {
    public static void main(String[] args) throws InterruptedException {
        Thread thread01 = new Thread(() -> {
            System.out.print("A");
        });

        Thread thread02 = new Thread(() -> {
                try {
                    thread01.join();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                System.out.print("B");
        });

        Thread thread03 = new Thread(() -> {
            try {
                    thread02.join();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }

                System.out.print("C");
        });

        for (int i = 0; i < 10; i++) {
            thread01.setDaemon(true);
            thread01.start();
            thread02.setDaemon(true);
            thread02.start();
            thread03.setDaemon(true);
            thread03.start();
        }

    }
}
